package cn.edu.scau.cmi.zenghanxiong.Singleton;
import cn.edu.scau.cmi.zenghanxiong.Singleton.Chairman;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.TextArea;
public class SingletonController{
	   @FXML
	   private Button myButton;
	   @FXML
	   private TextField myTextField;
	   @FXML
	   private TextArea	myTextArea;
	   
	   int x=0;
	   public void showChairman(ActionEvent event) {
		   String text=myTextField.getText();
		   Chairman chairman=cn.edu.scau.cmi.zenghanxiong.Singleton.Chairman.getInstance(text);
		   if(x==0) {
			   
			   
			   myTextArea.appendText(chairman.getName()+'@'+chairman.getNum()+'\n');
			   x++;
		   }
		   else {
			   myTextArea.appendText("该模式下已有对象创建，无法创建新对象了！\n您现在的对象是："
		   +chairman.getName()+'@'+chairman.getNum()+'\n');
		   }
	   }
}
